<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});
Route::group(['namespace'=>'Api',],function (){

//测试模块接口
    Route::group(['prefix'=>'test'],function (){
        //路由测试
        Route::get('/test','TestController@test');
        Route::get('/test1','TestController@test1');
        Route::post('/test1','TestController@test1');
        Route::get('/test2','TestController@test2');
        Route::post('/test2','TestController@test2');
    });

    //注册 登录 模块接口
    Route::group(['prefix'=>'loing'],function (){
        //注册
        Route::post('/register','LoginController@register');
        //登录
        Route::post('/doLogin','LoginController@doLogin');
        //验证码
        Route::post('/sendSms','LoginController@sendSms');


        //需要校验身份令牌的
        Route::group(['middleware' => 'auth:api'], function () {
            //用户信息
            Route::get('getDetails','LoginController@getDetails');
            //退出
            Route::get('loginout','LoginController@loginout');

        });
    });
    //会员资料模块接口
    Route::group(['prefix'=>'member'],function (){
        //忘记密码
        Route::post('/forgetPassword','MemberController@forgetPassword');

        //需要校验身份令牌的
        Route::group(['middleware' => 'auth:api'], function () {
            //修改密码
            Route::post('changePassword','MemberController@changePassword');
            //修改会员信息
            Route::post('changeInformation','MemberController@changeInformation');
        });
    });
    //漫画项目模块接口
    Route::group(['prefix'=>'cartoon'],function (){


        //需要校验身份令牌的
        Route::group(['middleware' => 'auth:api'], function () {
            //漫画项目列表
            Route::get('/getList','CartoonController@getList');
            //添加漫画项目
            Route::post('/addCartoon','CartoonController@addCartoon');
            //修改漫画项目
            Route::post('/saveCartoon','CartoonController@saveCartoon');
            //删除漫画项目
            Route::delete('/delCartoon','CartoonController@delCartoon');
            //漫画项目详情
            Route::get('/getCartoonInfo','CartoonController@getCartoonInfo');
            //添加漫画项目成员
            Route::post('/addCartoonMembers','CartoonController@addCartoonMembers');
            //修改漫画项目成员
            Route::post('/saveCartoonMembers','CartoonController@saveCartoonMembers');
            //删除漫画项目成员
            Route::delete('/delCartoonMembers','CartoonController@delCartoonMembers');
            //漫画项目成员列表
            Route::get('/getCartoonMembers','CartoonController@getCartoonMembers');
            //添加漫画项目人物角色
            Route::post('/addCartoonRole','CartoonController@addCartoonRole');



        });
    });

    //漫画剧本模块
    Route::group(['prefix'=>'script'],function (){

        //需要校验身份令牌的
        Route::group(['middleware' => 'auth:api'], function () {
            //漫画项目列表
            Route::get('/getList','ScriptController@getList');
            //添加漫画剧本
            Route::post('/addScript','ScriptController@addScript');
            //修改漫画剧本
            Route::post('/saveScript','ScriptController@saveScript');
            //删除漫画剧本
            Route::delete('/delScript','ScriptController@delScript');
            //漫画剧本详情
            Route::get('/getScriptInfo','ScriptController@getScriptInfo');

        });
    });

    Route::group(['middleware' => 'auth:api'], function () {
        //素材模块
        Route::group(['prefix'=>'resource'],function (){
            Route::post('/lists','ResourceController@lists');
            //标签库
            Route::post('/categories','ResourceController@categories');
            //标签搜索
            Route::post('/tags','ResourceController@tags');
            //照片列表
            Route::post('/pictures','ResourceController@pictures');
            //角色照片列表
            Route::post('/rolePictures','ResourceController@rolePictures');
            //照片详情
            Route::post('/picInfo','ResourceController@picInfo');
        });

        Route::group(['prefix'=>'my'],function (){
                //我的素材列表
                Route::post('/lists','MyController@upload_lists');
                //素材上传
                Route::post('/works_upload','MyController@works_upload');
            });

        //角色模块
        Route::group(['prefix'=>'character'],function (){
            //角色创建
            Route::post('/create','CharacterController@create');
            //角色详情
            Route::post('/info','CharacterController@info');
            //角色编辑
            Route::post('/edit','CharacterController@edit');
            //角色删除
            Route::post('/del','CharacterController@del');
            //角色素材列表
            Route::post('/source','CharacterController@source');
            //漫画角色库列表
            Route::get('/getCartoonRoleList','CharacterController@getCartoonRoleList');
            //我的角色库列表
            Route::post('/myCartoonRoleList','CharacterController@myCartoonRoleList');
            //删除漫画角色库关联
            Route::delete('/delCartoonRole','CharacterController@delCartoonRole');
        });

        //章节管理
        Route::group(['prefix'=>'chapter'],function (){
            //章节创建
            Route::post('/create','ChapterController@create');
            //章节顺序替换
            Route::post('/sort','ChapterController@sort');
            //章节列表
            Route::post('/list','ChapterController@list');
            //章节删除
            Route::post('/del','ChapterController@del');
            //章节漫画保存
            Route::post('/savePic','ChapterController@savePic');
            //章节漫画详情
            Route::post('/picInfo','ChapterController@picInfo');
            //章节漫画编辑
            Route::post('/picEdit','ChapterController@picEdit');
            //章节漫画列表
            Route::post('/picList','ChapterController@picList');
            //章节漫画删除
            Route::post('/picDel','ChapterController@picDel');
            //章节漫画移动
            Route::post('/movePic','ChapterController@movePic');
        });
    });





    Route::group(['prefix'=>'common'],function (){
        Route::post('/ossToken','CommonController@oss_token');
        Route::post('/upload','CommonController@upload');
    });

    Route::group(['prefix'=>'upload'],function (){
        Route::post('/uploadImg','UploadController@uploadImg');
    });
});